import {defineStore} from "pinia";
import {computed, ref} from "vue";

export const useShopStore = defineStore('shop', () => {
    const shopInfoList = ref([
        {
            id: 1,
            name: "沃尔码",
            imgUrl: "http://www.dell-lee.com/imgs/vue3/near.png",
            sales: 10000,
            expressLimit: 0,
            expressPrice: 5,
            slogan: "VIP尊享满89元减4元运费券",
            category: [
                {
                    id: 11,
                    name: "新鲜水果",
                    list: [
                        {
                            id: 111,
                            title: "番茄 250g / 份",
                            imgName: "tomato",
                            sales: 10,
                            number: 0,
                            checked: true,
                            price: 3.6,
                            oldPrice: 5.6
                        },
                        {
                            id: 112,
                            title: "车厘子 500g / 份",
                            imgName: "cherry",
                            sales: 10,
                            number: 0,
                            checked: true,
                            price: 33.9,
                            oldPrice: 39.9
                        },
                        {
                            id: 113,
                            title: "橙子 500g / 份",
                            imgName: "orange",
                            sales: 110,
                            number: 0,
                            checked: true,
                            price: 12.9,
                            oldPrice: 22.9
                        }
                    ]
                },
                {
                    id: 12,
                    name: "海鲜水产",
                    list: [
                        {
                            id: 121,
                            title: "帝王蟹 250g / 份",
                            imgName: "crab",
                            sales: 10,
                            number: 0,
                            checked: true,
                            price: 99.9,
                            oldPrice: 199.9
                        }
                    ]
                }
            ],
            cartList: []
        },
        {
            id: 2,
            name: "山姆会员商店",
            imgUrl: "http://www.dell-lee.com/imgs/vue3/near.png",
            sales: 2000,
            expressLimit: 0,
            expressPrice: 5,
            slogan: "联合利华洗护满10减5",
            category: [
                {
                    id: 21,
                    name: "新鲜水果",
                    list: [
                        {
                            id: 211,
                            title: "番茄 250g / 份",
                            imgName: "tomato",
                            sales: 10,
                            number: 0,
                            checked: true,
                            price: 3.6,
                            oldPrice: 5.6
                        },
                        {
                            id: 212,
                            title: "桃子 500g / 份",
                            imgName: "tomato",
                            sales: 10,
                            number: 0,
                            checked: true,
                            price: 33.9,
                            oldPrice: 39.9
                        },
                        {
                            id: 213,
                            title: "橙子 500g / 份",
                            imgName: "orange",
                            sales: 110,
                            number: 0,
                            checked: true,
                            price: 12.9,
                            oldPrice: 22.9
                        }
                    ]
                },
                {
                    id: 22,
                    name: "海鲜水产",
                    list: [
                        {
                            id: 221,
                            title: "帝王蟹 250g / 份",
                            imgName: "crab",
                            sales: 9,
                            number: 0,
                            checked: true,
                            price: 99.9,
                            oldPrice: 199.9
                        },
                        {
                            id: 222,
                            title: "虾 250g / 份",
                            imgName: "tomato",
                            sales: 19,
                            number: 0,
                            checked: true,
                            price: 39.9,
                            oldPrice: 59.9
                        }
                    ]
                },
                {
                    id: 23,
                    name: "零食小吃",
                    list: [
                        {
                            id: 231,
                            title: "薯片 250g / 份",
                            imgName: "tomato",
                            sales: 20,
                            number: 0,
                            checked: true,
                            price: 9.9,
                            oldPrice: 19.9
                        },
                        {
                            id: 232,
                            title: "饼干 250g / 份",
                            imgName: "tomato",
                            sales: 10,
                            number: 0,
                            checked: true,
                            price: 3.9,
                            oldPrice: 5.9
                        }
                    ]
                }
            ],
            cartList: []
        }
    ])
    const shopInfo = ref({})
    const getShopInfo = (shopData) => {
        shopInfo.value = shopData
    }

        return { shopInfoList,shopInfo,getShopInfo}
  })